<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>审核管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(function() {
			$("#inputForm").validate({
				rules: {
					status:{required:true},
					approval:{required:true}
				},
				messages:{
					status:{
						required:"请选择审核状态"
					},
					approval:{
						required:"请填写审核信息",
					}
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			$("#btnSubmit").click(function(){
				if(window.confirm('请确定审批要通过吗？')){
					var statusValue=$("#status").val("1");
						var arr1 = $(".falseversion");
						var arr2 = $(".falseserverexplain");
						var str1="";
						var str2="";
						for(var i=0;i<arr1.length;i++){
							str1+=$(arr1[i]).val();
							str2+=$(arr2[i]).val();
							if(i!=arr1.length-1){
								str1+="(@#$%^&*)";
								str2+="(@#$%^&*)";
							}
						}
						$("#version").val(str1);
						$("#serverexplain").val(str2);
	                $("#btnSubmit").submit();
	                return true;
	             }else{
	                return false;
	            }
			});
			$("#btnSubmits").click(function(){
				if(window.confirm('请确定审批不通过吗？')){
					var statusValue=$("#status").val("-1");
					$("#version").val("");
					$("#serverexplain").val("");
	                $("#btnSubmit").submit();
	                return true;
	             }else{
	                return false;
	            }
			});
		});
	</script>
	
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/projectdemo/serverinformation/form?id=${serverinformation.id}">填写审核信息</a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="serverinformation" action="${ctx}/projectdemo/serverinformation/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="projectid"/>
		<form:hidden path="version" id="version"/>
		<form:hidden path="serverexplain" id="serverexplain"/>
		<form:hidden path="status" id="status"/>
		<sys:message content="${message}"/>	
		<h3 class="text-primary text-center">服务器审核</h3>	<br><br>
		<div  style="width:60%;margin: auto;border:solid 1px #36648B;">
		<div class="control-group">
			<label class="control-label"><strong>项目名字：</strong></label>
			<label class="control-label"><strong><p class="text-left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${serverinformation.projectname}</p></strong></label>
		</div>
		<c:forEach items="${serverinformation.typeList}" var="type">
		<br>
		<div id="div" style="border:solid 1px #98FB98;">
		<div class="control-group">
			<label class="control-label"><strong>服务器类型：</strong></label>
			<label class="control-label"><strong><p class="text-left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${type}</p></strong></label>
		</div>
		<div class="control-group">
			<label class="control-label"><strong>版本：</strong></label>
			<div class="controls">
				<input name="falseversion" type="text" value=" " class="falseversion"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><strong>服务器信息说明：</strong></label>
			<div class="controls">
				<textarea name="falseserverexplain" value=" " class="falseserverexplain"></textarea>
			</div>
		</div>
		</div>
		<br>
		</c:forEach>
		<div class="control-group">
			<label class="control-label"><strong>审核信息：</strong></label>
			<div class="controls">
				<form:textarea path="approval" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
			</div>
		</div>
		</div>
		<div class="form-actions" style="padding-left: 20%">
			<shiro:hasPermission name="projectdemo:serverinformation:edit">
				<input id="btnSubmit" class="btn btn-primary" type="button" value="同意"/>&nbsp;
				<input id="btnSubmits" class="btn btn-primary" type="button" value="不同意"/>&nbsp;
			</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="window.location.href='${ctx}/projectdemo/serverinformation/'"/>
		</div>
	</form:form>
</body>
</html>